import G6 from '@antv/g6';

// 默认节点配置
export const defaultNodeConfig = {
  type: "card-node",
  style: {
      cursor: 'pointer',
      fill: '#ffffff',
      stroke: '#3056E3',
  },
  labelCfg: {//字体样式
      style: {
          fill: '#666',
          fontSize: 12,
      },
  }
}

// 默认线条配置
export const defaultEdgeConfig = {
  type: 'can-running',
  style: {
      stroke: '#3056E3',
      strokeOpacity: 1,
      lineWidth: 1.5,
      lineAppendWidth: 3,
      endArrow: { 
          path: G6.Arrow.triangle(8, 8, 1),
          d: 0,
          fill: '#3056E3',
      },
  },
  labelCfg: {
      autoRotate: true,
      refY: 10,
  }
};

// 默认布局配置
export const defaultLayout = {
  type: 'force',
  preventOverlap: true,
  nodeSpacing: 70,
  linkDistance: (d) => {
    return 200;
  },
  nodeStrength: (d) => {
    if (d.isLeaf) {
      return -30;
    }
    return -10;
  },
}

export const dendrogramLayout = {
    type:      'dendrogram',
    direction: 'V', // H / V / LR / RL / TB / BT
    nodeSep: 100,//节点间距
    rankSep: 100,//层与层之间的间距
}
